import Vue from "vue";
import VueRouter from "vue-router";

import Home from "../pages/Home";
import Login from "../pages/Login";
// 引入二级路由的组件
import Music from "../pages/Home/Music";
import News from "../pages/Home/News";
import Entertainment from "../pages/Home/Entertainment";

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "/home",
      component: Home,
      name: "home",
      children: [
        {
          path: "news",
          component: News,
          name: "news",
        },
        {
          path: "music",
          component: Music,
          name: "music",
        },
        {
          path: "entertainment",
          component: Entertainment,
          name: "entertainment",
        },
      ],
    },
    {
      path: "/login",
      component: Login,
      name: "login",
    },
  ],
});

export default router;
